Prizm Content Connect
How to Configure PHP Samples

Supported PHP Versions

The Prizm Content Connect PHP Sample requires PHP version 5.4 and above.

Linux Installation

  1. Install Prizm Content Connect for Linux and verify the service is working correctly. The installation will place the PHP samples in the following directory: /usr/share/prizm/Samples/php.
  2. Install Apache and PHP. Refer to the directions that are specific to your distribution.
  3. Add the following to the Apache configuration:
 
Copy Code
Alias /pccis_sample /usr/share/prizm/Samples/php
<Directory /usr/share/prizm/Samples/php>
AllowOverride All
</Directory>
  1. On the command line, first check that the configuration file validates:
Example
Copy Code
apache2ctl configtest
  1. Then restart the Apache service to read the configuration changes:
Example
Copy Code
apache2ctl restart
  1. Give read/write permissions to the Documents folder and the Markups folder. Give read permissions to the ImageStamp folder. These folders are installed to: /usr/share/prizm/Samples on Linux. For more information, see the "Configuration with pcc.config" section below.
  2. Test the sample application in a browser. The following will route you directly to the HTML5 viewer sample splash page: http://myservername:port/pccis_sample/splash

Windows Installation

By default, the PHP sample is installed to: C:\Prizm\Samples\php, assuming use of the default Prizm Content Connect location of C:\Prizm.

IIS

Install IIS, along with the CGI component, and then install and configure PHP. The instructions and installer provided on the IIS site are now old and outdated, as they install PHP version 5.3. Instead, install the latest version of PHP using the Web Platform Installer. If using an already configured server, make sure you are using PHP version 5.4 or higher.

To configure the sample:

  1. Note the location of the PHP sample as described above. If you changed the Prizm Content Connect default install location, note the comparable sample in the install location you specified.
  2. Open the IIS Manager.
  3. In the Sites list, select the site you want to add the PHP sample to, such as "Default Web Site". Right-click on it and select "Add Virtual Directory…".
  4. In the Alias field, type the URL path you want to use for the sample. We will use "pccis_sample" as an example here.
  5. In the Physical Path field, use the location we noted above. Click OK to create the virtual directory.

Now you can browse to http://localhost/pccis_sample/splash in your browser to see the PHP sample.

Apache

Install Apache, or an Apache stack like XAMPP or WAMP server, and a supported version of PHP.

To configure the sample:

  1. Note the location of the PHP sample as described above. If you changed the Prizm Content Connect default install location, note the comparable sample in the install location you specified.
  2. Open the httpd.conf file of your Apache install.
  3. In the block starting with "<IfModule alias_module>", add the following to the end of the block:
Example
Copy Code
# PCC PHP sample alias
 Alias /pccis_sample "C:/Prizm/Samples/php"
 <Directory "C:/Prizm/Samples/php">
 Allow from all
 Require all granted
 </Directory>
  1. Restart Apache so that it picks up the new settings.

Now you can browse to http://localhost/pccis_sample/splash in your browser to see the PHP sample.

Optional Configuration

By default, PHP has a small file size upload. If you need to be able to upload larger files through the splash page, you may need to change the following values in the php.ini file of your PHP installation:

Example
Copy Code
upload_max_filesize = 1000M
post_max_size = 1000M

This sets the file upload to 1GB, which should be enough to test most files through the splash page. These settings may be too high for a production service, so adjust those accordingly when deploying to production.

Browsing the Sample

From the splash page you have two options:

PHP Directory Structure

The PHP Sample folder contains 3 sub-folders, one folder for each of the two samples (book-reader-sample and full-viewer-sample) and one folder for the splash page:

Each of the sample folders are completely self-contained, meaning that they contain all of the files needed to run the sample. Furthermore, with the exception of a few project files and build files, the sample folders contain only the files needed to run the sample.

Folder contents: full-viewer-sample

File / Folder

Description

viewer-assets folder

Contains the essential JavaScript, CSS, fonts, images, language data, and templates (HTML) that make up the viewer.

viewer-assets/less folder

Contains less that can be used to build the viewer CSS. This folder is non-essential, and does not need to be re-distributed.

viewer-assets/Gruntfile.js

Contains Grunt tasks to build the viewer less. This file is non-essential and does not need to be re-distributed.

viewer-assets/package.json

A file used by npm (a package manager). It defines the dependencies installed by npm, which are required to run Grunt and compile the less.

viewer-webtier folder

Contains files that implement the php layer of communication between the client-side viewer and the PCC backend services.

viewer-webtier/pcc.php

Contains the supporting functions for the RESTful communication between the viewer and web server. The client side viewer Javascript object will use this RESTful interface as described in PCC RESTful API. The file is required for functionality in a PHP enabled web server environment. While the code for the functions can be modified as needed, modifications should be done with care. Most of the current web server RESTful interface passes the request onto Prizm Services.

viewer-webtier/pcc.config

Defines the configuration for the web tier. Configuration parameters include: Path to source documents, path to saved markup files, path to image stamp files, and connection settings for the PCC RESTful API.

viewer-webtier/imagingServiceProxy.php

This class provides a common set of methods for communicating with the PCC Imaging Service.

viewer-webtier/pccConfig.php

This class parses the pcc.config file and provides methods for easily reading its parameters.

viewer-webtier/utils.php

A class containing helpful methods used frequently throughout the application.

index.php

The default web starting page in this sample. The HTML5 viewer’s code gets loaded by this page.

.htaccess

Contains Apache web server settings.

predefinedSearch.json

This data file contains information defining search queries that will appear as selectable items in the full viewer.

Note: This file is consumed by the page Default.aspx and the JSON is injected into the HTML that is returned by Default.aspx. Ultimately, the predefined search terms are provided as a JavaScript hash, when the viewer is created.

redactionReason.json

This data file contains information defining redaction reasons that are available in the viewer.

Note: This file is consumed by the page Default.aspx and the JSON is injected into the HTML that is returned by Default.aspx. Ultimately, the redaction reasons are provided as a JavaScript hash, when the viewer is created.

Folder contents: book-reader-sample

File / Folder

Description

viewer-assets folder

Contains the essential JavaScript, CSS, fonts, images, language data, and templates (HTML) that make up the book reader viewer.

viewer-assets/less folder

Contains less that can be used to build the viewer CSS. This folder is non-essential, and does not need to be re-distributed.

viewer-assets/Gruntfile.js

Contains Grunt tasks to build the viewer less. This file is non-essential and does not need to be re-distributed.

viewer-assets/package.json

A file used by npm (a package manager). It defines the dependencies installed by npm, which are required to run Grunt and compile the less.

viewer-assets/selection.json

A file used by the IcoMoon application to generate the icons in the book reader viewer.  If you need to add an icon to the viewer, you can add the icon to this file and use the IcoMoon application (https://icomoon.io) to generate a new icon font. This file is non-essential and does not need to be re-distributed.

viewer-webtier folder

Contains files that implement the php layer of communication between the client-side book reader viewer and the PCC backend services.

viewer-webtier/createSession.php

This file is used by index.html to create a PCC Viewing Session with the PCC RESTful API.

viewer-webtier/pcc.php

Contains the supporting functions for the RESTful communication between the book reader viewer and web server. The client side viewer Javascript object will use this RESTful interface as described in PCC RESTful API. The file is required for functionality in a PHP enabled web server environment. While the code for the functions can be modified as needed, modifications should be done with care. Most of the current web server RESTful interface passes the request onto Prizm Services.

viewer-webtier/pcc.config

Defines the configuration for the web tier. Configuration parameters include: Path to source documents, path to saved markup files, path to image stamp files, and connection settings for the PCC RESTful API.

viewer-webtier/imagingServiceProxy.php

This class provides a common set of methods for communicating with the PCC Imaging Service.

viewer-webtier/pccConfig.php

This class parses the pcc.config file and provides methods for easily reading its parameters.

viewer-webtier/utils.php

A class containing helpful methods used frequently throughout the application.

index.html

The default page for the sample. This page calls the createSession.php service to start a viewing session with the PCC RESTful services and then the page loads the book reader.

sample-config.js

Contains references to the assets, web tier, and language files used by the viewer in this sample.

.htaccess

Contains Apache web server settings.

Configuration with pcc.config

The file pcc.config is used to configure the resources and storage used by the viewer web tier. This file can be found in each sample folder at: <sample-folder-name>/viewer-webtier/pcc.config. This file is self-documenting, but a little information about the configuration options is given below:

<DocumentPath>

The sample pulls named documents from this location. The DocumentPath must have read/write permissions in order for the file drag and drop functionality of the splash page to work.

<ImageStampPath>

The sample pulls image stamps from this location. Any valid image stamp in this folder will be available to the viewer for use as an image stamp. The ImageStampPath must have read permissions.

<ValidImageStampTypes>

A comma separated value list of file extensions. These extensions specify the valid image stamp file types. Only images in the ImageStampPath with a valid file type will be available for use as an image stamp in the viewer.

<MarkupsPath>

Saved markup XML is kept in this folder. The MarkupsPath will be written to by the web server process, so it must have read/write permissions.      

<WebService[Scheme|Host|Port|Path|V2Path]>

Specifies how to connect with the PCC RESTful API.

 

 

 


©2015. Accusoft Corporation. All Rights Reserved.

Send Feedback